﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using DAL;

namespace FCTC_Web.Models
{
    public enum AppointmentStatusEnum
    {
        未处理,
        正在处理,
        客户放弃评估,
        评估完成
    }

    public class VehicleEstimation : EntityBase
    {
        public VehicleEstimation()
        {
            AppointmentStatus = AppointmentStatusEnum.未处理.ToString();
        }
        public int? VehicleID { get; set; }
        public virtual Vehicle Vehicle { get; set; }

        public int? EstimatorID { get; set; }
        public virtual Estimator Estimator { get; set; }

        [MaxLength(10)]
        [Display(Name = "预约状态"), Required]
        public string AppointmentStatus { get; set; }

        public int? PersonalID { get; set; }
        public Personal Personal { get; set; }

        [Display(Name = "预约评估时间"), Required(ErrorMessage = "请选择预约时间")]
        public DateTime AppointmentDate { get; set; }

        [Display(Name = "预约客户留言"), Required(ErrorMessage = "请留下对您车子的描述")]
        public string ApplyerMsg { get; set; }

       [Display(Name = "联系手机"), Required(ErrorMessage = "电话号码不能为空")]
       [DataType(DataType.Text), MaxLength(30), RegularExpression(@"(13[0-9]{9}|18[0-9]{9}|15[0-9]{9})|(^(\d{3,4}-)?\d{7,8})$", ErrorMessage = "请填写正确的联系电话")]
        public string ContactNumber
        {
            get
            {
                if (Personal != null)
                    return Personal.Contact;
                else
                    return string.Empty;
            }
            set
            {
                if (Personal != null)
                    Personal.Contact = value;
            }
        }
        [Display(Name = "配置"), Required(ErrorMessage = "请选择车子的配置")]
        public string VehicleStyle
        {
            get
            {
                if (Vehicle != null)
                    return Vehicle.VehicleStyle;
                else
                    return string.Empty;
            }
            set
            {
                if (Vehicle != null)
                    Vehicle.VehicleStyle = value;
            }
        }
        [Display(Name = "品牌"), Required(ErrorMessage = "请选择车子的品牌")]
        public string CarBrand
        {
            get
            {
                if (Vehicle != null)
                    return Vehicle.CarBrand;
                else
                    return string.Empty;
            }
            set
            {
                if (Vehicle != null)
                    Vehicle.CarBrand = value;
            }
        }
        [Display(Name = "型号"), Required(ErrorMessage = "请选择车子的型号")]
        public string BrandType
        {
            get
            {
                if (Vehicle != null)
                    return Vehicle.BrandType;
                else
                    return string.Empty;
            }
            set
            {
                if (Vehicle != null)
                    Vehicle.BrandType = value;
            }
        }



    }
}